﻿using System.ComponentModel;
using System.Data.Linq.Mapping;

namespace LuyenThiVer03.UserData
{
    [Table]
    public class DeThiCauHoi
    {
        private int _deThiID;
        private long _cauHoiID;
        private int _monHocID;
        private int _maTranKienThucID;

        [Column(CanBeNull = false, IsPrimaryKey = true)]
        public int DeThiID
        {
            get { return _deThiID; }
            set
            {
                if (value == _deThiID) return;
                NotifyPropertyChanging("DeThiID");
                _deThiID = value;
                NotifyPropertyChanged("DeThiID");
            }
        }

        [Column(CanBeNull = false)]
        public int MonHocID
        {
            get { return _monHocID; }
            set
            {
                if (value == _monHocID) return;
                NotifyPropertyChanging("MonHocID");
                _monHocID = value;
                NotifyPropertyChanged("MonHocID");
            }
        }

        [Column(CanBeNull = false, IsPrimaryKey = true)]
        public long CauHoiID
        {
            get { return _cauHoiID; }
            set
            {
                if (value == _cauHoiID) return;
                NotifyPropertyChanging("CauHoiID");
                _cauHoiID = value;
                NotifyPropertyChanged("CauHoiID");
            }
        }

        [Column(CanBeNull = false)]
        public int MaTranKienThucID
        {
            get { return _maTranKienThucID; }
            set
            {
                if (value == _maTranKienThucID) return;
                NotifyPropertyChanging("MaTranKienThucID");
                _maTranKienThucID = value;
                NotifyPropertyChanged("MaTranKienThucID");
            }
        }

        private void NotifyPropertyChanging(string propertyName)
        {
            if (PropertyChanging != null)
            {
                PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
            }
        }

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
    }
}
